#ifndef HATERH_INIFILE_H_
#define HATERH_INIFILE_H_

#include <iostream>
using namespace std;

namespace Zen{ namespace utility{ namespace ini{

class IniFilePrivate;
class IniFile
{
public:
    IniFile();
    virtual ~IniFile(); 
    bool Load(istream& is);  
    bool Save(ostream& os) const;
    bool DecryptLoad(istream& is);
    bool EncryptSave(ostream& os) const;
    bool EncryptSave(ostream& os, const IniFile& other) const;
    int GetNumber(const string& key, bool* ok=NULL) const;
    string GetString(const string& key, bool* ok=NULL) const;
    bool PutNumber(const string& key, int value, bool fail_if_exist=false);
    bool PutString(const string& key, const string& value, bool fail_if_exist=false);
    void RemoveKey(const string& key);
    void RemoveSection(const string& section_name);
    void BeginSection(const string& section_name);
    void EndSection();

protected:  
    virtual bool Decrypt(ostream& decrypted, istream& encrypted) const;
    virtual bool Encrypt(ostream& encrypted, istream& decrypted) const;

private:
    IniFilePrivate& m;
};

}}}

#endif // HATERH_INIFILE_H_